Back to course home
0% completed
Vote For New Content
Microsoft Hard Problems
Regular Expression Matching (hard)
Solution: Regular Expression Matching
First Missing Positive (hard)
Solution: First Missing Positive
Largest Rectangle in Histogram (hard)
Solution: Largest Rectangle in Histogram
Sliding Window Maximum (hard)
Solution: Sliding Window Maximum
Count Unique Characters of All Substrings of a Given String (hard)
Solution: Count Unique Characters of All Substrings of a Given String
Word Ladder (hard)
Solution: Word Ladder
Word Ladder II (hard)
Solution: Word Ladder II
Number of Flowers in Full Bloom (hard)
Solution: Number of Flowers in Full Bloom
Median of Two Sorted Arrays (hard)
Solution: Median of Two Sorted Arrays
Longest Valid Parentheses (hard)
Solution: Longest Valid Parentheses
Nth Digit (medium)
Problem Statement
Given a positive integer n, find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... and so on.
Examples
-
Example 1:
- Input:
n = 3 - Expected Output:
3 - Justification: The sequence starts as
1, 2, 3...so the third digit is3.
- Input:
-
Example 2:
- Input:
n = 110000 - Expected Output:
2 - Justification: In the sequence, the 110,000th digit is part of a larger number where the pattern has expanded beyond single, double, and triple digits. Specifically, it falls within the range of five or more digit numbers, landing on a
2.
- Input:
-
Example 3:
- Input:
n = 15 - Expected Output:
2 - Justification: Considering the sequence, the 15th digit falls in the number
12, which is2.
- Input:
Try it yourself
Try solving this question here:
Java
Saved to Cloud
. . . .
Solution: Merge Two Sorted Lists
Solution: Nth Digit
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself